#include "settings.h"
#include <cassert>

Settings::Settings()
: _HA(0), _KM(0), _GM(1), _FF(4), _SZ(19)
{
    if(!_AB.empty()) _AB.clear();
}

Settings::~Settings()
{

}

/** write functions **/
/** write functions **/
/** write functions **/
void Settings::write_HA(int handicaps)
{
    assert(handicaps>=0 && handicaps <10);
    _HA = handicaps;
}

void Settings::write_KM(double komi)
{
    assert(komi>=0);
    _KM = komi;
}

void Settings::write_FF(int version)
{
    assert(version>=1);
    _FF = version;
}

void Settings::write_RU(string rule)
{
    _RU = rule;
}

void Settings::write_SZ(int size)
{
    assert(size>=1 && size%2);
    _SZ = size;
}

void Settings::write_AB(int x,int y)
{
    assert( (x>=1 && x<=_SZ) && (y>=1 && y<=_SZ) );
    coordinate coo;
    coo.first = x;
    coo.second = y;

    _AB.push_back(coo);
}

/** get functions **/
/** get functions **/
/** get functions **/
int Settings::get_HA()
{
    return _HA;
}

double Settings::get_KM()
{
    return _KM;
}

int Settings::get_FF()
{
    return _FF;
}

string Settings::get_RU() const
{
    return _RU;
}

int Settings::get_SZ()
{
    return _SZ;
}

series Settings::get_AB() const
{
    return _AB;
}
